﻿using System;
using System.Numerics;

class CatalanNumber
{
    static void Main()
    {
        int numberN;

        Console.WriteLine("Type first number:");
        bool isNumberValid = int.TryParse(Console.ReadLine(), out numberN);

        if (isNumberValid)
        {
            decimal result=1;

            int twoTimesNFactorial=1;
            int nPlusOneFactorial=1;
            int nFactorial=1;

            while (true)
            {
                if (twoTimesNFactorial <= 2 * numberN)
                {
                    result *= twoTimesNFactorial;
                    twoTimesNFactorial++;
                }
                else
                {
                    break;
                }

                if (nPlusOneFactorial <= 1 + numberN)
                {
                    result /= nPlusOneFactorial;
                    nPlusOneFactorial++;
                }
                if (nFactorial <= numberN)
                {
                    result /= nFactorial;
                    nFactorial++;
                }
            }
            Console.WriteLine(result);
        }
        else
        {
            Console.WriteLine("Your input isn`t OK!!!");
        }
    }
}